package com.chanceit.ssss.dialog;

import android.graphics.drawable.ColorDrawable;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.PopupWindow;

public class SimplePopuWindow extends PopupWindow implements
		PopupWindow.OnDismissListener {
	public SimplePopuWindow(View contentView) {
		super(contentView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		setBackgroundDrawable(new ColorDrawable(0x11ffffff));
		setOutsideTouchable(true);
		setAnimationStyle(android.R.style.Animation_Dialog);
		update();
		setTouchable(true);
		setFocusable(true);
		setOnDismissListener(this);
	};

	private boolean isShow;

	@Override
	public void showAsDropDown(View anchor) {
		super.showAsDropDown(anchor);
		isShow = true;
	}

	@Override
	public void showAtLocation(View parent, int gravity, int x, int y) {
		super.showAtLocation(parent, gravity, x, y);
		isShow = true;
	}

	@Override
	public void showAsDropDown(View anchor, int xoff, int yoff) {
		super.showAsDropDown(anchor, xoff, yoff);
		isShow = true;
	}

	@Override
	public void onDismiss() {
		isShow = false;
	}

	@Override
	public void dismiss() {
		super.dismiss();
		isShow = false;
	}

	@Override
	public boolean isShowing() {
		return isShow;
	}
}
